/* 
类来实现接口
*/
(() => {
  interface Alarm {
    alert(): void  // 没有方法体的方法 ==> 抽象方法
  }

  interface Light {
    lightOn (): void
    lightOff (): void
  }


  class Car implements Alarm {
    alert(): void {
      console.log('alert()')
    }
  }

  const c = new Car()
  c.alert()

  class Car2 implements Alarm, Light {
    alert(): void {
      console.log('Car2 alert()')
    }

    lightOn (): void {
      console.log('Car2 lightOn()')
    }

    lightOff (): void {
      console.log('Car2 lightOff()')
    }
  }
  const c2 = new Car2()
  c2.alert()
  c2.lightOff()
  c2.lightOn()

  interface LightAlert extends Alarm, Light {

  }

  class Car3 implements LightAlert {
    alert(): void {
      console.log('Car3 alert()')
    }

    lightOn (): void {
      console.log('Car3 lightOn()')
    }

    lightOff (): void {
      console.log('Car3 lightOff()')
    }
  }
})()